home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 12393 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: news.tiac.net!usenet
  2. From: nield@tiac.net (John Nield)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help: 2 short functions
  5. Date: Sat, 30 Mar 1996 21:53:47 GMT
  6. Organization: The Internet Access Company
  7. Message-ID: <4jkaim$rch@news.tiac.net>
  8. References: <4ji734$n6v@masala.cc.uh.edu> <29MAR199622515778@erich.triumf.ca> <4jit3o$f7l@news.tiac.net>
  9. Reply-To: nield@tiac.net
  10. NNTP-Posting-Host: nield.tiac.net
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. oops, never gave memory to fp. oh well. . . (jnield@versanet.com) ==
  14. (nield@tiac.net) == John Nield
  15.  
  16. jnield@versanet.com (jnield@versanet.com) wrote:
  17.  
  18. >FILE *open_file(char *filenamep)
  19. >{
  20. >   FILE *fp;
  21. >   if ( !(fp=fopen(filenamep,"r")) )
  22. >        {failbad();}
  23. >                            /* a string literal is turned into a
  24. >                               character pointer when it is compiled, so
  25. >                               you can use filenamep as the string for fopen.
  26. >                               */
  27. >   free(filenamep); /* assuming you want to do it now...
  28. >                        'string' and all other pointers to the string
  29. >                        are now junk. */
  30. >   return fp;
  31. >}
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.